package com.example.testapplication.util;

import android.content.Context;
import android.content.SharedPreferences;

// 缓存工具类
public class CacheUtils {

    // 保存数据
    public static void putString(Context context,String key,String values){
        SharedPreferences sharedPreferences = context.getSharedPreferences("okhttp",Context.MODE_PRIVATE);
        sharedPreferences.edit().putString(key,values).commit();
    }

    // 得到缓存数据
    public static String getString(Context context,String key){
        SharedPreferences sharedPreferences = context.getSharedPreferences("okhttp",Context.MODE_PRIVATE);
        return sharedPreferences.getString(key,"");
    }
}
